#pragma once

class AESCrypt
{
public:
	AESCrypt(void);
	~AESCrypt(void);

	bool SetEncryptKey(const unsigned char* caeskey, const unsigned char* civec = NULL);

	bool SetDecryptKey(const unsigned char* caeskey, const unsigned char* civec = NULL);

	bool Encrypt(const unsigned char *in, unsigned char *out, size_t length);

	bool Decrypt(const unsigned char *in, unsigned char *out, size_t length);

	bool MD5hash(const unsigned char *in, size_t length, unsigned char *out);

	bool MakeMD5(unsigned char *md, unsigned char* out);

private:

	unsigned char ivec[AES_BLOCK_SIZE*4];
	unsigned char key[16];
	AES_KEY aes_key;
	bool IsUseIge;

	unsigned char md[MD5_DIGEST_LENGTH];
};
